package org.xm.sk.vo.tb;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ManyToMany;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;
import org.xm.sk.vo.Base;

import com.fasterxml.jackson.annotation.JsonIgnore;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;

@Entity
@Getter
@Setter
@Table(name = "dc_server_time")
@ApiModel(value = "ServerTime", parent = Base.class, description = "发型师服务时间点")
public class ServerTime extends Base {

    /**
     * 
     */
    private static final long serialVersionUID = -6403977829671632337L;

    @ApiModelProperty(value = "服务时间点")
    @Column(length = 5)
    private String name;

    @ApiModelProperty(value = "时间点对应的发型师")
    @JsonIgnore
    @ManyToMany(cascade = {
            CascadeType.MERGE }, fetch = FetchType.LAZY, mappedBy = "serverTimes")
    @Fetch(FetchMode.SUBSELECT)
    private Set<Hairdresser> hairdressers = new HashSet<Hairdresser>(0);

    @ApiModelProperty(value = "时间点对应的发型师ID")
    @Transient
    private Integer hairdresserId;

    @ApiModelProperty(value = "时间点对应的发型师名称")
    @Transient
    private String hairdresserName;
    
    @ApiModelProperty(value = "可否预约，有值都不能预约，0为已被预约，1为已过时")
    @Transient
    private Integer status;

}
